package com.itheima.health.service.impl;

import com.itheima.health.dao.TuDao;
import com.itheima.health.service.TuService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@Service
public class TuServiceImpl implements TuService {
    @Autowired
    private TuDao tuDao;
    @Override
    public ArrayList<Integer> chaxionghuiyuanshuliang(List<String> months) {
        //用一个集合装查出来的数，再返回
        ArrayList<Integer> arr = new ArrayList<>();
        for (String month : months) {
            Long chaxiongrenshu = tuDao.chaxiongrenshu(month);
            arr.add(chaxiongrenshu.intValue());
        }
        return arr;
    }

    /**
     * 查询套餐占比
     * @return
     */
    @Override
    public List<Map<String, Object>> chaciongtaochanzhanbi() {
        return tuDao.chaciongtaochanzhanbi();
    }
}
